package com.ddwl.user.dao.mapper;

import com.ddwl.common.dao.mapper.TkMapper;
import com.ddwl.user.dao.model.UserAuth;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Fu Zhaohui
 * @version 1.0.0
 * @date 2019/6/12 13:42
 */
@Repository
public interface UserAuthMapper extends TkMapper<UserAuth> {

    @Delete("DELETE FROM sys_user_auth WHERE user_id = #{userId}  and product=#{product}")
    void deleteByUserId(@Param("userId")String userId, @Param("product")String product);

    @Update("UPDATE sys_user_auth SET user_id= #{toUserId} WHERE user_id= #{fromUserId}")
    void mergeAuth(@Param("fromUserId") String fromUserId, @Param("toUserId")String toUserId);
}
